<template>
	<view class="dAlert" v-show="show">
		<view class="wrapperAlert">
			<slot name="selfAlert">
				<view class="vueDAlertWrapper">
					<view class="vueDAlertWrapperTop" style="background: url('/static/image/common/alert-bg.png') no-repeat center center;background-size: 100% 100%;"></view>
					<view class="alert-content">
						<slot></slot>
					</view>
				</view>
			</slot>
			<view class="close-alert" @click.stop="clickBtn('cancel')">
				<u-icon name="close" color="#fff" size="36"></u-icon>
			</view>
		</view>
		<view class="maskHiddenmask"></view>
	</view>
</template>


<script>
	export default {
		props: {
			desc: String,
			cancelTxt: {
				type: String,
				default: () => ''
			},
			color: {
				type: String,
				default: () => '#333'
			},
		},
		data(){
			return {
				submit_loading: false
			}
		},
		computed: {
			show(){
				return this.$modalStore.state.show;
			},
			showCancel(){
				return this.$modalStore.state.showCancel;
			}
		},
		watch:{
			alertStatus(e){
				if (e==true) {
					this.alertStatus = true
				}
			}
		},
		methods:{
			closeModal(){
				this.$modalStore.commit('hideModal')
			},
		},
		beforeDestroy(){
			this.$modalStore.commit('hideModal')
		}
	}
</script>

<style lang="scss" scoped>
	.maskHiddenmask {
		z-index: 10000;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background-color: rgba(0,0,0, .7);
		transition: background-color .15s linear;
	}
	.wrapperAlert {
		z-index: 12000;
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		transition: background-color .15s linear;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		.close-alert{
			margin-top: 30rpx;
			width: 70rpx;
			height: 70rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			background-color: rgba(0,0,0,.2);
			border-radius: 50%;
		}
	}
	.vueDAlertWrapper {
		display: flex;
		flex-direction: column;
		align-items: center;
		width: 576rpx;
		border-radius: 30rpx;
		overflow: hidden;
		position: relative;
		min-height: 274rpx;
		.vueDAlertWrapperTop {
			height: 274rpx;
			background-size: 576rpx 274rpx;
			position: absolute;
			left: 0;
			right: 0;
			top: 0;
		}
		.alert-content{
			box-sizing: border-box;
			margin-top: 200rpx;
			background-color: #fff;
			width: 100%;
			padding: 120rpx 30rpx 55rpx;
			.desc-txt{
				font-size: 32rpx;
				text-align: center;
				font-weight: 500;
				color: #333;
			}
			.rh-btn-container{
				margin-top: 70rpx;
				display: flex;
				flex-direction: column;
				align-items: center;
				.cancel-btn{
					margin-top: 35rpx;
					font-size: 30rpx;
					color: #999;
				}
			}
		}
	}
</style>